<?php

function getGameUrl ($appkey='VjJZTlpnRThCemRVWUFGbEJETUFOdz09'){
    $url = "https://gctest205.ko10.cn/lyunify/loginlygameurl/";
    //$url = "https://gc.ko10.cn/h5/loginlygameurl/";
    $ly = "wozan";
    $loginkey = "116wozanf131d4bec77748bab9a25853a586b131";
    $user_info = session('user_info');
    if (!empty($user_info)) {
        $user = json_decode($user_info, true);
        $uid = $user['id'];
        $uname = 'wozan'.$user['id'];
        $nname = urlencode($user['nick_name']);
        $ptime = date('Y-m-d H:i:s');
        $cm = 1;
        $pfType = "android";
        if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone')||strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')){
            $pfType = "ios";
        }
        $sign = strtolower(md5($appkey.$ly.$uid.$uname.$ptime.$cm.$loginkey));
    
        $param_arr = array ('appkey'=>$appkey,'ly'=>$ly,'uid'=>$uid,'uname'=>$uname,'nname'=>$nname,
            'ptime'=>$ptime,'cm'=>$cm,'pfType'=>$pfType,'sign'=>$sign);
        $param = json_encode($param_arr);
        $key = base64_encode($param);
        $url = $url.$ly.'/'.$key;
        return $url;
    }
    return '';
    
}